﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.ProductPlanning.DTO;
using PowerHub.MES.DTO.ProductPlanning.QueryDTO;
using PowerHub.MES.Entities.ProductPlanning;
using PowerHub.MES.IServices.IProductPlanning;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.ProductPlanning
{
    /// <summary>
    /// 产品
    /// </summary>
    [ApiController]
    [Route("Api/MES/ProductPlanning/[controller]/[action]")]
    public class ProductBillController
    {

        private IProductPlanning_ProductBillServices _ProductPlanning_ProductBillServices;

        public ProductBillController(IProductPlanning_ProductBillServices ProductBillServices)
        {
            _ProductPlanning_ProductBillServices = ProductBillServices;
        }

        /// <summary>
        /// 获取产品列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取产品列表")]
        public async Task<OperationPageResult<List<ProductPlanning_ProductBill>>> GetProductPlanning_ProductBillPageListAsync([FromBody] QueryProductPlanning_ProductBillDTO pageQuery)
        {
            return await _ProductPlanning_ProductBillServices.GetProductPlanning_ProductBillPageListAsync(pageQuery);
        }

        /// <summary>
        ///根据产品id获取产品
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("根据产品id获取产品")]
        public async Task<OperationResult<ProductPlanning_ProductBillDTOS>> GetProductPlanning_ProductBillByIdListAsync([FromBody] QueryProductPlanning_ProductBillDTO pageQuery)
        {
            return await _ProductPlanning_ProductBillServices.GetProductPlanning_ProductBillByIdListAsync(pageQuery);
        }

        /// <summary>
        /// 批量删除产品
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除产品")]
        public async Task<OperationResult<bool>> DeletionProductPlanning_ProductBillAsync([FromBody] List<string> Query)
        {
            return await _ProductPlanning_ProductBillServices.DeletionProductPlanning_ProductBillAsync(Query);
        }

        /// <summary>
        /// 更新产品
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新产品")]
        public async Task<OperationResult<bool>> UpdateProductPlanning_ProductBillAsync([FromBody] ProductPlanning_ProductBillDTO Query)
        {
            return await _ProductPlanning_ProductBillServices.UpdateProductPlanning_ProductBillAsync(Query);
        }

        /// <summary>
        /// 添加产品
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加产品")]
        public async Task<OperationResult<bool>> CreateProductPlanning_ProductBillAsync([FromBody] ProductPlanning_ProductBillDTO Query)
        {
            return await _ProductPlanning_ProductBillServices.CreateProductPlanning_ProductBillAsync(Query);
        }

        /// <summary>
        /// 添加产品BOM
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加产品BOM")]
        public async Task<OperationResult<bool>> CreateProductPlanning_ProductBillDetialAsync([FromBody] List<ProductPlanning_ProductBillDetialDTO> Query)
        {
            return await _ProductPlanning_ProductBillServices.CreateProductPlanning_ProductBillDetialAsync(Query);
        }
        /// <summary>
        /// 修改产品BOM
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("修改产品BOM")]
        public async Task<OperationResult<bool>> UpdateProductPlanning_ProductBillDetialAsync(ProductPlanning_ProductBillDetial query)
        {
            return await _ProductPlanning_ProductBillServices.UpdateProductPlanning_ProductBillDetialAsync(query);
        }


        /// <summary>
        /// 删除产品BOM清单
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("删除产品BOM清单")]
        public async Task<OperationResult<bool>> DeletionProductPlanning_ProductBillDetialAsync(List<string>? query)
        {
            return await _ProductPlanning_ProductBillServices.DeletionProductPlanning_ProductBillDetialAsync(query);
        }



    }
}
